package cn.fiveinone.master;

import cn.fiveinone.entity.HelloNamingFacade;
import cn.fiveinone.entity.HelloNamingFacadeImpl;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

/**
 * @Description
 * @auther Szper
 * @create 2019-10-22 12:59
 */
public class MasterSolver {
    public static void main(String[] args) {
        try {
            LocateRegistry.createRegistry(1100);
            HelloNamingFacade hello = new HelloNamingFacadeImpl();
            Naming.bind("rmi://localhost:1100/HelloNaming", hello);
            System.out.println("======= 启动RMI服务成功! =======");
        } catch (RemoteException | MalformedURLException | AlreadyBoundException e) {
            e.printStackTrace();
        }
    }
}
